package com.iwop.moto.service.impl;

import com.iwop.moto.model.SuperRecordModel;
import com.iwop.moto.service.BaseService;
import com.iwop.moto.service.ReportService;
import com.iwop.moto.service.WxPayService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuwb 2016-10-27 19:10:46
 */
@Service
public class WxPayServiceImpl extends BaseService implements WxPayService {

    /**
     * @功能:微信交易记录 - 新增
     */
    public void insert(SuperRecordModel SRModel) {
        getSqlSession().insert("FWxPayMapper.insert",SRModel);
    }

    /**
     * @功能:查询微信支付订单是否已经存在
     */
    public Long findPayTransactionCount(String transaction_id){
        return getSqlSession().selectOne("FWxPayMapper.findPayTransactionCount",transaction_id);
    }

    /**
     * @功能:根据sid查询
     */
    public SuperRecordModel findBySid(String sid ){
        return getSqlSession().selectOne("FWxPayMapper.findBySid",sid);
    }

    /**
     * @功能: 根据组合参数查询
     */
    public List<SuperRecordModel> findByParams(SuperRecordModel SRModel){
        return getSqlSession().selectList("FWxPayMapper.findByParams",SRModel);
    }

    /**
     * @功能: 根据组合参数查询统计count
     */
    public Long findByParamsCount(SuperRecordModel SRModel){
        return getSqlSession().selectOne("FWxPayMapper.findByParamsCount",SRModel);
    }

    public Long findByParamsTotalFee(SuperRecordModel SRModel){
        return getSqlSession().selectOne("FWxPayMapper.findByParamsTotalFee",SRModel);
    }

    @Override
    public SuperRecordModel findByOutTradeNo(String outTradeNo) {
        return getSqlSession().selectOne("FWxPayMapper.findByOutTradeNo",outTradeNo);
    }
}
